Skip to content

[MLIR][Dialect] Add XeVM dialect #144811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 4, 2025
Merged

[MLIR][Dialect] Add XeVM dialect #144811

merged 14 commits into from
Jul 4, 2025

Conversation

silee2
Copy link
Contributor

@silee2 silee2 commented Jun 18, 2025

XeVM is a new dialect that is designed to exposes Intel GPU hardware features in a future proof way.
RFC is here: https://discourse.llvm.org/t/mlir-rfc-dialect-xevm-proposal-for-new-xevm-dialect/86955
In short, XeVM is the nvvm or rocdl for Intel GPU.

The RFC includes background and challenges that XeVM is designed to solve.
And also lists plan for upstreaming at the end.
This PR is the first of a series and it covers dialect definition and op tests only.

Co-authored-by: Artem Kroviakov [email protected]

@llvmbot
Copy link
Member

llvmbot commented Jun 18, 2025

@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-llvm

@llvm/pr-subscribers-mlir-gpu

Author: Sang Ik Lee (silee2)

Changes

Patch is 48.67 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/144811.diff

9 Files Affected:

  • (modified) mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt (+10)
  • (added) mlir/include/mlir/Dialect/LLVMIR/XeVMDialect.h (+28)
  • (added) mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td (+550)
  • (modified) mlir/include/mlir/InitAllDialects.h (+3-1)
  • (modified) mlir/lib/Dialect/LLVMIR/CMakeLists.txt (+22)
  • (added) mlir/lib/Dialect/LLVMIR/IR/XeVMDialect.cpp (+381)
  • (modified) mlir/test/Dialect/LLVMIR/invalid.mlir (+43-2)
  • (added) mlir/test/Dialect/LLVMIR/xevm.mlir (+76)
  • (modified) mlir/test/lib/Dialect/GPU/CMakeLists.txt (+1)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
index 9c5bbae1022f7..cfad07e57021f 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
@@ -87,3 +87,13 @@ mlir_tablegen(VCIXConversions.inc -gen-llvmir-conversions)
 mlir_tablegen(VCIXOpsAttributes.h.inc -gen-attrdef-decls -attrdefs-dialect=vcix)
 mlir_tablegen(VCIXOpsAttributes.cpp.inc -gen-attrdef-defs -attrdefs-dialect=vcix)
 add_public_tablegen_target(MLIRVCIXConversionsIncGen)
+
+add_mlir_dialect(XeVMOps xevm)
+add_mlir_doc(XeVMOps XeVMDialect Dialects/ -gen-dialect-doc -dialect=xevm)
+set(LLVM_TARGET_DEFINITIONS XeVMOps.td)
+mlir_tablegen(XeVMConversions.inc -gen-llvmir-conversions)
+mlir_tablegen(XeVMOpsEnums.h.inc -gen-enum-decls)
+mlir_tablegen(XeVMOpsEnums.cpp.inc -gen-enum-defs)
+mlir_tablegen(XeVMOpsAttributes.h.inc -gen-attrdef-decls -attrdefs-dialect=xevm)
+mlir_tablegen(XeVMOpsAttributes.cpp.inc -gen-attrdef-defs -attrdefs-dialect=xevm)
+add_public_tablegen_target(MLIRXeVMConversionsIncGen)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/XeVMDialect.h b/mlir/include/mlir/Dialect/LLVMIR/XeVMDialect.h
new file mode 100644
index 0000000000000..a83d4248c862c
--- /dev/null
+++ b/mlir/include/mlir/Dialect/LLVMIR/XeVMDialect.h
@@ -0,0 +1,28 @@
+//===-- XeVMDialect.h - MLIR XeVM target definitions ------------*- C++ -*-===//
+//
+// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_LLVMIR_XEVMDIALECT_H_
+#define MLIR_DIALECT_LLVMIR_XEVMDIALECT_H_
+
+#include "mlir/Bytecode/BytecodeOpInterface.h"
+#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/IR/Dialect.h"
+#include "mlir/IR/OpDefinition.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
+
+#include <mlir/Dialect/LLVMIR/XeVMOpsEnums.h.inc>
+
+#define GET_ATTRDEF_CLASSES
+#include <mlir/Dialect/LLVMIR/XeVMOpsAttributes.h.inc>
+
+#define GET_OP_CLASSES
+#include <mlir/Dialect/LLVMIR/XeVMOps.h.inc>
+
+#include <mlir/Dialect/LLVMIR/XeVMOpsDialect.h.inc>
+
+#endif /* MLIR_DIALECT_LLVMIR_XEVMDIALECT_H_ */
diff --git a/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td
new file mode 100644
index 0000000000000..9525c4a731efa
--- /dev/null
+++ b/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td
@@ -0,0 +1,550 @@
+//===-- XeVMOps.td - XeVM dialect definition ---------------*- tablegen -*-===//
+//
+// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef XEVMIR_OPS
+#define XEVMIR_OPS
+
+include "mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td"
+include "mlir/Dialect/LLVMIR/LLVMOpBase.td"
+include "mlir/Interfaces/SideEffectInterfaces.td"
+
+include "mlir/IR/OpBase.td"
+include "mlir/IR/EnumAttr.td"
+
+def XeVM_Dialect : Dialect {
+  let name = "xevm";
+  let cppNamespace = "::mlir::xevm";
+  let dependentDialects = ["LLVM::LLVMDialect"];
+
+  let extraClassDeclaration = [{
+    /// Get the name for the attribute used to specify cache control
+    /// decorations.
+    static constexpr ::llvm::StringRef getCacheControlsAttrName() {
+      return ::llvm::StringLiteral("xevm.DecorationCacheControl");
+    }
+  }];
+
+  let useDefaultAttributePrinterParser = 1;
+}
+
+class XeVM_Attr<string attrName, string attrMnemonic, list<Trait> traits = []>
+    : AttrDef<XeVM_Dialect, attrName, traits> {
+  let mnemonic = attrMnemonic;
+}
+
+class XeVM_Op<string mnemonic, list<Trait> traits = []>
+    : Op<XeVM_Dialect, mnemonic, traits> {
+
+  code extraBaseClassDeclaration = [{
+    void printProperties(::mlir::MLIRContext *ctx,
+            ::mlir::OpAsmPrinter &p, const Properties &prop,
+            ::mlir::ArrayRef<::llvm::StringRef> elidedProps) {
+      Attribute propAttr = getPropertiesAsAttr(ctx, prop);
+      if (propAttr)
+        p << "<" << propAttr << ">";
+    }
+
+    static ::mlir::ParseResult parseProperties(::mlir::OpAsmParser &parser,
+                                     ::mlir::OperationState &result) {
+      if (mlir::succeeded(parser.parseOptionalLess())) {
+        if (parser.parseAttribute(result.propertiesAttr) || parser.parseGreater())
+          return failure();
+      }
+      return success();
+    }
+
+  }];
+}
+
+def XeVM_ElemType : AnyTypeOf<[AnyI8, AnyI16, AnyI32, F32, TF32, F16, BF16]>;
+
+def LoadCacheControlDefault : I32EnumAttrCase<"DEFAULT", 0, "Default">;
+def LoadCacheControl_L1uc_L2uc_L3uc
+    : I32EnumAttrCase<"L1UC_L2UC_L3UC", 1, "L1uc_L2uc_L3uc">;
+def LoadCacheControl_L1uc_L2uc_L3c
+    : I32EnumAttrCase<"L1UC_L2UC_L3C", 2, "L1uc_L2uc_L3c">;
+def LoadCacheControl_L1uc_L2c_L3uc
+    : I32EnumAttrCase<"L1UC_L2C_L3UC", 3, "L1uc_L2c_L3uc">;
+def LoadCacheControl_L1uc_L2c_L3c
+    : I32EnumAttrCase<"L1UC_L2C_L3C", 4, "L1uc_L2c_L3c">;
+def LoadCacheControl_L1c_L2uc_L3uc
+    : I32EnumAttrCase<"L1C_L2UC_L3UC", 5, "L1c_L2uc_L3uc">;
+def LoadCacheControl_L1c_L2uc_L3c
+    : I32EnumAttrCase<"L1C_L2UC_L3C", 6, "L1c_L2uc_L3c">;
+def LoadCacheControl_L1c_L2c_L3uc
+    : I32EnumAttrCase<"L1C_L2C_L3UC", 7, "L1c_L2c_L3uc">;
+def LoadCacheControl_L1c_L2c_L3c
+    : I32EnumAttrCase<"L1C_L2C_L3C", 8, "L1c_L2c_L3c">;
+def LoadCacheControl_L1s_L2uc_L3uc
+    : I32EnumAttrCase<"L1S_L2UC_L3UC", 9, "L1s_L2uc_L3uc">;
+def LoadCacheControl_L1s_L2uc_L3c
+    : I32EnumAttrCase<"L1S_L2UC_L3C", 10, "L1s_L2uc_L3c">;
+def LoadCacheControl_L1s_L2c_L3uc
+    : I32EnumAttrCase<"L1S_L2C_L3UC", 11, "L1s_L2c_L3uc">;
+def LoadCacheControl_L1s_L2c_L3c
+    : I32EnumAttrCase<"L1S_L2C_L3C", 12, "L1s_L2c_L3c">;
+def LoadCacheControlInvalidateRead
+    : I32EnumAttrCase<"INVALIDATE_READ", 13, "ir">;
+
+def XeVM_LoadCacheControl
+    : I32EnumAttr<
+          "LoadCacheControl", "XeVM load ops cache control",
+          [LoadCacheControlDefault, LoadCacheControl_L1uc_L2uc_L3uc,
+           LoadCacheControl_L1uc_L2uc_L3c, LoadCacheControl_L1uc_L2c_L3uc,
+           LoadCacheControl_L1uc_L2c_L3c, LoadCacheControl_L1c_L2uc_L3uc,
+           LoadCacheControl_L1c_L2uc_L3c, LoadCacheControl_L1c_L2c_L3uc,
+           LoadCacheControl_L1c_L2c_L3c, LoadCacheControl_L1s_L2uc_L3uc,
+           LoadCacheControl_L1s_L2uc_L3c, LoadCacheControl_L1s_L2c_L3uc,
+           LoadCacheControl_L1s_L2c_L3c, LoadCacheControlInvalidateRead]> {
+  let cppNamespace = "::mlir::xevm";
+  let genSpecializedAttr = 0;
+}
+
+def XeVM_LoadCacheControlAttr
+    : EnumAttr<XeVM_Dialect, XeVM_LoadCacheControl, "load_cache_control"> {
+  let summary = [{Describe the cache settings for load operators}];
+  let assemblyFormat = "`<` $value `>`";
+}
+
+def StoreCacheControlDefault : I32EnumAttrCase<"DEFAULT", 0, "Default">;
+def StoreCacheControl_L1uc_L2uc_L3uc
+    : I32EnumAttrCase<"L1UC_L2UC_L3UC", 1, "L1uc_L2uc_L3uc">;
+def StoreCacheControl_L1uc_L2uc_L3wb
+    : I32EnumAttrCase<"L1UC_L2UC_L3WB", 2, "L1uc_L2uc_L3wb">;
+def StoreCacheControl_L1uc_L2wb_L3uc
+    : I32EnumAttrCase<"L1UC_L2WB_L3UC", 3, "L1uc_L2wb_L3uc">;
+def StoreCacheControl_L1uc_L2wb_L3wb
+    : I32EnumAttrCase<"L1UC_L2WB_L3WB", 4, "L1uc_L2wb_L3wb">;
+def StoreCacheControl_L1wt_L2uc_L3uc
+    : I32EnumAttrCase<"L1WT_L2UC_L3UC", 5, "L1wt_L2uc_L3uc">;
+def StoreCacheControl_L1wt_L2uc_L3wb
+    : I32EnumAttrCase<"L1WT_L2UC_L3WB", 6, "L1wt_L2uc_L3wb">;
+def StoreCacheControl_L1wt_L2wb_L3uc
+    : I32EnumAttrCase<"L1WT_L2WB_L3UC", 7, "L1wt_L2wb_L3uc">;
+def StoreCacheControl_L1wt_L2wb_L3wb
+    : I32EnumAttrCase<"L1WT_L2WB_L3WB", 8, "L1wt_L2wb_L3wb">;
+def StoreCacheControl_L1s_L2uc_L3uc
+    : I32EnumAttrCase<"L1S_L2UC_L3UC", 9, "L1s_L2uc_L3uc">;
+def StoreCacheControl_L1s_L2uc_L3wb
+    : I32EnumAttrCase<"L1S_L2UC_L3WB", 10, "L1s_L2uc_L3wb">;
+def StoreCacheControl_L1s_L2wb_L3uc
+    : I32EnumAttrCase<"L1S_L2WB_L3UC", 11, "L1s_L2wb_L3uc">;
+def StoreCacheControl_L1s_L2wb_L3wb
+    : I32EnumAttrCase<"L1S_L2WB_L3WB", 12, "L1s_L2wb_L3wb">;
+def StoreCacheControl_L1wb_L2uc_L3uc
+    : I32EnumAttrCase<"L1WB_L2UC_L3UC", 13, "L1wb_L2uc_L3uc">;
+def StoreCacheControl_L1wb_L2wb_L3uc
+    : I32EnumAttrCase<"L1WB_L2WB_L3UC", 14, "L1wb_L2wb_L3uc">;
+def StoreCacheControl_L1wb_L2uc_L3wb
+    : I32EnumAttrCase<"L1WB_L2UC_L3WB", 15, "L1wb_L2uc_L3wb">;
+
+def XeVM_StoreCacheControl
+    : I32EnumAttr<
+          "StoreCacheControl", "XeVM store ops cache control",
+          [StoreCacheControlDefault, StoreCacheControl_L1uc_L2uc_L3uc,
+           StoreCacheControl_L1uc_L2uc_L3wb, StoreCacheControl_L1uc_L2wb_L3uc,
+           StoreCacheControl_L1uc_L2wb_L3wb, StoreCacheControl_L1wt_L2uc_L3uc,
+           StoreCacheControl_L1wt_L2uc_L3wb, StoreCacheControl_L1wt_L2wb_L3uc,
+           StoreCacheControl_L1wt_L2wb_L3wb, StoreCacheControl_L1s_L2uc_L3uc,
+           StoreCacheControl_L1s_L2uc_L3wb, StoreCacheControl_L1s_L2wb_L3uc,
+           StoreCacheControl_L1s_L2wb_L3wb, StoreCacheControl_L1wb_L2uc_L3uc,
+           StoreCacheControl_L1wb_L2wb_L3uc,
+           StoreCacheControl_L1wb_L2uc_L3wb]> {
+  let cppNamespace = "::mlir::xevm";
+  let genSpecializedAttr = 0;
+}
+
+def XeVM_StoreCacheControlAttr
+    : EnumAttr<XeVM_Dialect, XeVM_StoreCacheControl, "store_cache_control"> {
+  let summary = [{Describe the cache settings for store operators}];
+  let assemblyFormat = "`<` $value `>`";
+}
+
+def XeVM_BlockLoad2dOp
+    : XeVM_Op<"blockload2d">,
+      Results<(outs FixedVectorOfRankAndType<[1], [XeVM_ElemType]>:$res)>,
+      Arguments<(ins Arg<LLVM_AnyPointer, "", [MemRead]>:$ptr, I32:$base_width,
+          I32:$base_height, I32:$base_pitch, I32:$x, I32:$y,
+          I32Attr:$elem_size_in_bits, I32Attr:$tile_width, I32Attr:$tile_height,
+          I32Attr:$v_blocks, I1Attr:$transpose, I1Attr:$pack_register,
+          OptionalAttr<XeVM_LoadCacheControlAttr>:$cache_control)> {
+
+  let summary = "2D block load";
+
+  let description = [{
+    The `xevm.blockload2d` operation loads a two dimensional matrix tile
+    from a base matrix residing in memory. The parameters are:
+      $ptr - the base address of the base matrix containing the tile to load
+      $base_width, $base_height, $base_pitch - the shape of the base matrix.
+      pitch is the physical stride between the first columns of the current row
+      and the subsequent row. All units are in bytes.
+      $x, $y, $tile_width, $tile_height - the starting offsets and shape of
+      the tile to load in number of elements.
+      $elem_size_in_bits - the size in bits of the matrix element type
+        - 32 for f32, tf32
+        - 16 for f16, int16, bf16
+        - 8 for int8
+      $v_blocks - number of consecutive tiles in innermost dimension direction to load
+      $transpose - transpose the tile in registers (useful for 32 bit element type)
+      $pack_register - pack element types narrower than register bit width. [M, N] => [M/factor, N, factor] where factor is register_size_in_bits / elem_size_in_bits
+      $cache_control - an enumerator that sets the cache behaviour
+
+    Notes:
+      - the $transpose and $pack_register parameters are mutual exclusive
+      - transposing the tile loaded is used for A matrix in backward path or used for the B matrix operand
+        (D = C + A * B), where A has row-major layout and B should have column-major layout in memory.
+      - if the tile loaded contains out of bound elements of the matrix, they are filled with 0.
+
+    Example:
+    ```mlir
+      %base_width_a = arith.constant 32 : i32
+      %base_height_a = arith.constant 8 : i32
+      %base_pitch_a = arith.constant 32 : i32
+      %x = arith.constant 0 : i32
+      %y = arith.constant 0 : i32
+      %loaded_a = xevm.blockload2d %src, %base_width_a, %base_height_a, %base_pitch_a, %x, %y <{elem_size_in_bits=16 : i32, tile_width=16 : i32, tile_height=8 : i32, v_blocks=1 : i32, transpose=false : i32, pack_register=false, cache_control=#xevm.load_cache_control<Default>}> : (!llvm.ptr<1>, i32, i32, i32, i32, i32) -> vector<8xi16>
+    ```
+  }];
+
+  let assemblyFormat = [{
+    operands prop-dict attr-dict `:` functional-type(operands, results)
+  }];
+
+  let extraClassDeclaration = extraBaseClassDeclaration#[{
+    /// Get cache control or return default if not set.
+    ::mlir::xevm::LoadCacheControl getCacheControlOrDefault() {
+      if(getCacheControl())
+        return *getCacheControl();
+      return ::mlir::xevm::LoadCacheControl::DEFAULT;
+    }
+  }];
+
+  let hasVerifier = 1;
+}
+
+def XeVM_BlockStore2dOp
+    : XeVM_Op<"blockstore2d">,
+      Arguments<(ins Arg<LLVM_AnyPointer, "", [MemWrite]>:$ptr, I32:$base_width,
+          I32:$base_height, I32:$base_pitch, I32:$x, I32:$y,
+          I32Attr:$elem_size_in_bits, I32Attr:$tile_width, I32Attr:$tile_height,
+          FixedVectorOfRankAndType<[1], [XeVM_ElemType]>:$stored_val,
+          OptionalAttr<XeVM_StoreCacheControlAttr>:$cache_control)> {
+
+  let summary = "2D block store";
+
+  let description = [{
+    The `xevm.blockstore2d` operation stores a two dimensional tile into a
+    larger matrix residing in memory. The parameters are:
+      $ptr - the base address of the target matrix where to store the tile
+      $base_width, $base_height, $base_pitch - the shape of the target matrix. pitch is the
+      physical stride between the first columns of the current row and the subsequent row.
+      All units are in bytes.
+      $x, $y, $tile_width, $tile_height - the starting offsets and shape of the tile to store
+      in number of elements.
+      $elem_size_in_bits - the size in bits of the matrix element
+        - 32 for f32, tf32
+        - 16 for f16, int16, bf16
+        - 8 for int8
+      $cache_control - an enumerator that sets the cache behaviour
+      $stored_val - the tile to store
+
+    Example:
+    ```mlir
+      %base_width_c = arith.constant 64 : i32
+      %base_height_c = arith.constant 8 : i32
+      %base_pitch_c = arith.constant 64 : i32
+      %x = arith.constant 0 : i32
+      %y = arith.constant 0 : i32
+      xevm.blockstore2d %dst, %base_width_c, %base_height_c, %base_pitch_c, %x, %y, %src <{elem_size_in_bits=32 : i32, tile_width=16 : i32, tile_height=8 : i32, cache_control=#xevm.load_cache_control<Default>}> : (!llvm.ptr<1>, i32, i32, i32, i32, i32, vector<8xi32>)
+    ```
+  }];
+
+  let assemblyFormat = [{
+    operands prop-dict attr-dict `:` `(` type(operands) `)`
+  }];
+
+  let extraClassDeclaration = extraBaseClassDeclaration#[{
+    /// Get cache control or return default if not set.
+    ::mlir::xevm::StoreCacheControl getCacheControlOrDefault() {
+      if(getCacheControl())
+        return *getCacheControl();
+      return ::mlir::xevm::StoreCacheControl::DEFAULT;
+    }
+
+    /// Default value for v_blocks is 1.
+    constexpr uint32_t getVBlocks() {
+      return 1;
+    }
+  }];
+
+  let hasVerifier = 1;
+}
+
+def MemScopeLane : I32EnumAttrCase<"LANE", 0, "lane">;
+def MemScopeSg : I32EnumAttrCase<"SUBGROUP", 1, "subgroup">;
+def MemScopeWg : I32EnumAttrCase<"WORKGROUP", 2, "workgroup">;
+def MemScopeCluster : I32EnumAttrCase<"CLUSTER", 3, "cluster">;
+def MemScopeDevice : I32EnumAttrCase<"DEVICE", 4, "device">;
+def MemScopeSystem : I32EnumAttrCase<"SYSTEM", 5, "system">;
+
+def XeVM_MemScope
+    : I32EnumAttr<"MemScope", "XeVM memory scope",
+                  [MemScopeLane, MemScopeSg, MemScopeWg, MemScopeCluster,
+                   MemScopeDevice, MemScopeSystem]> {
+  let genSpecializedAttr = 0;
+  let cppNamespace = "::mlir::xevm";
+}
+def XeVM_MemScopeAttr : EnumAttr<XeVM_Dialect, XeVM_MemScope, "mem_scope"> {
+  let summary = [{Describe memory scopes}];
+  let assemblyFormat = "`<` $value `>`";
+}
+
+def AddrSpacePrivate : I32EnumAttrCase<"PRIVATE", 0, "private">;
+def AddrSpaceGlobal : I32EnumAttrCase<"GLOBAL", 1, "global">;
+def AddrSpaceConstant : I32EnumAttrCase<"CONSTANT", 2, "constant">;
+def AddrSpaceShared : I32EnumAttrCase<"SHARED", 3, "shared">;
+def AddrSpaceGeneric : I32EnumAttrCase<"GENERIC", 4, "generic">;
+
+def XeVM_AddrSpace
+    : I32EnumAttr<"AddrSpace", "Address spaces",
+                  [AddrSpacePrivate, AddrSpaceGlobal, AddrSpaceConstant,
+                   AddrSpaceShared, AddrSpaceGeneric]> {
+  let genSpecializedAttr = 0;
+  let cppNamespace = "mlir::xevm";
+}
+def XeVM_AddrSpaceAttr : EnumAttr<XeVM_Dialect, XeVM_AddrSpace, "addr_space"> {
+  let summary = [{Describe address spaces}];
+  let assemblyFormat = "`<` $value `>`";
+}
+
+def XeVM_MemfenceOp
+    : XeVM_Op<"memfence">,
+      Arguments<(ins XeVM_MemScopeAttr:$scope,
+          DefaultValuedAttr<XeVM_AddrSpaceAttr,
+                            "mlir::xevm::AddrSpace::GENERIC">:$addrspace)> {
+  let summary = "Work-item's memory fence.";
+  let description = [{
+    This operation ensures that all prior memory accesses of this
+    work-item to `addrspace` are visible to all other work-items in `scope`.
+    Parameters description:
+    $scope - specify the memory scope at which all other work-items should observe
+                memory operations prior to the fence.
+    $addrspace - specify the address space of work-item's memory accesses
+                to be affected by the fence.
+  }];
+  let assemblyFormat = [{prop-dict  attr-dict}];
+
+  let extraClassDeclaration = extraBaseClassDeclaration#[{
+  }];
+}
+
+def XeVM_PrefetchOp
+    : XeVM_Op<"prefetch">,
+      Arguments<(ins Arg<LLVM_AnyPointer, "", [MemRead]>:$ptr,
+          XeVM_AddrSpaceAttr:$addrspace,
+          OptionalAttr<XeVM_LoadCacheControlAttr>:$cache_control)> {
+  let summary = "Prefetch data into a cache subsystem.";
+  let description = [{
+    Work-item issues a prefetch from global memory to cache:
+    $ptr - memory pointer.
+    $addrspace - address space of a pointer, must be generic or global.
+    $cache_control - specify caching options
+  }];
+  let assemblyFormat = [{
+    operands prop-dict attr-dict `:` `(` type(operands) `)`
+  }];
+
+  let extraClassDeclaration = extraBaseClassDeclaration#[{
+    /// Get cache control or return default if not set.
+    ::mlir::xevm::LoadCacheControl getCacheControlOrDefault() {
+      if(getCacheControl())
+        return *getCacheControl();
+      return ::mlir::xevm::LoadCacheControl::DEFAULT;
+    }
+  }];
+
+  let hasVerifier = 1;
+}
+
+def XeVM_BlockPrefetch2dOp
+    : XeVM_Op<"blockprefetch2d">,
+      Arguments<(ins Arg<LLVM_AnyPointer, "", [MemRead]>:$ptr, I32:$base_width,
+          I32:$base_height, I32:$base_pitch, I32:$x, I32:$y,
+          I32Attr:$elem_size_in_bits, I32Attr:$tile_width, I32Attr:$tile_height,
+          I32Attr:$v_blocks,
+          OptionalAttr<XeVM_LoadCacheControlAttr>:$cache_control)> {
+
+  let summary = "2D block prefetch";
+
+  let description = [{
+    The `xevm.blockprefetch2d` operation prefetches a two dimensional tile
+    from a larger base matrix residing in memory. The parameters are:
+      $ptr - the base address of the base matrix containing the tile to prefetch
+      $base_width, $base_height, $base_pitch - the shape of the base matrix.
+      pitch is the physical stride between the first columns of the current row
+      and the subsequent row. All units are in bytes.
+      $x, $y, $tile_width, $tile_height - the starting offsets and shape of tile
+      to prefetch in number of elements.
+      $elem_size_in_bits - the size in bits of the matrix element
+      - 32 for f32, bf32
+      - 16 for f16, int16, bf16
+      - 8 for int8, int4, int2
+      $v_blocks - number of tiles in innermost dimension direction to prefetch
+      $cache_control - an enumerator that sets the cache behaviour
+
+    Example:
+    ```mlir
+      xevm.blockprefetch2d %ptr, %base_width, %base_height, %base_pitch, %x, %y <{elem_size_in_bits=8 : i32, tile_width=32 : i32, tile_height=8 : i32, v_blocks=1 : i32, cache_control=#xevm.load_cache_control<L1uc_L2uc_L3uc>}> : (!llvm.ptr<1>, i32, i32, i32, i32, i32)
+    ```
+  }];
+
+  let assemblyFormat = [{
+    operands prop-dict attr-dict `:` `(` type(operands) `)`
+  }];
+
+  let extraClassDeclaration = extraBaseClassDeclaration#[{
+    /// Get cache control or return default if not set.
+    ::mlir::xevm::LoadCacheControl getCacheControlOrDefault() {
+     ...
[truncated]

@silee2
Copy link
Contributor Author

silee2 commented Jun 20, 2025

Copy link
Contributor

@kurapov-peter kurapov-peter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some minor comments

@silee2
Copy link
Contributor Author

silee2 commented Jun 30, 2025

@adam-smnk @kurapov-peter @akroviakov I think I have addressed all comments directly or replied to them. Can you take another look at the changes/replies?

@rengolin
Copy link
Member

Overall comment, this looks very similar to ROCdl and NVVM: In LLVM IR dialect, same structure, sits at the same level, does similar things. All in all, this looks good to start the XeGPU/XeVM development upstream. Thanks!

Copy link
Contributor

@adam-smnk adam-smnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good already, in line with GPU specification and other dialects.
Thanks for the tweaks 👍

Minor comments

Copy link
Member

@rengolin rengolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been discussed and approved by the MLIR Area Team. I'm adding my approval on behalf of that decision, but please make sure all reviews have finished to merge. Thank you!

@rengolin
Copy link
Member

rengolin commented Jul 4, 2025

Just realized you don't have commit access. All reviews were addressed and we have enough approvers. I'll merge this for you. Please keep an eye on buildbots.

@rengolin rengolin merged commit b9b2661 into llvm:main Jul 4, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 4, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/14390

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6851/7914] Linking CXX shared library lib/libclangFrontendTool.so.21.0git
[6852/7914] Creating library symlink lib/libclangFrontendTool.so
[6853/7914] Linking CXX shared module lib/CheckerDependencyHandlingAnalyzerPlugin.so
[6854/7914] Linking CXX shared module lib/SampleAnalyzerPlugin.so
[6855/7914] Linking CXX shared module lib/CheckerOptionHandlingAnalyzerPlugin.so
[6856/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/logical.test.dir/logical.cpp.o
[6857/7914] Linking CXX shared library lib/libclangInterpreter.so.21.0git
[6858/7914] Creating library symlink lib/libclangInterpreter.so
[6859/7914] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o
[6860/7914] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  -lpthread  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: In function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockLoad2dOp>(mlir::xevm::BlockLoad2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0x5f): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0xb4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: In function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockPrefetch2dOp>(mlir::xevm::BlockPrefetch2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0x5f): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0xb4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: In function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockStore2dOp>(mlir::xevm::BlockStore2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0x5f): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0xb4): more undefined references to `mlir::getConstantIntValue(mlir::OpFoldResult)' follow
collect2: error: ld returned 1 exit status
[6861/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/real.test.dir/real.cpp.o
[6862/7914] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[6863/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[6864/7914] Building InstCombineTables.inc...
[6865/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6866/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6867/7914] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6868/7914] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6869/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6870/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6871/7914] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6872/7914] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 50, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 41, in main
    run_command(["ninja"])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 63, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6851/7914] Linking CXX shared library lib/libclangFrontendTool.so.21.0git
[6852/7914] Creating library symlink lib/libclangFrontendTool.so
[6853/7914] Linking CXX shared module lib/CheckerDependencyHandlingAnalyzerPlugin.so
[6854/7914] Linking CXX shared module lib/SampleAnalyzerPlugin.so
[6855/7914] Linking CXX shared module lib/CheckerOptionHandlingAnalyzerPlugin.so
[6856/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/logical.test.dir/logical.cpp.o
[6857/7914] Linking CXX shared library lib/libclangInterpreter.so.21.0git
[6858/7914] Creating library symlink lib/libclangInterpreter.so
[6859/7914] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o
[6860/7914] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  -lpthread  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: In function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockLoad2dOp>(mlir::xevm::BlockLoad2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0x5f): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0xb4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: In function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockPrefetch2dOp>(mlir::xevm::BlockPrefetch2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0x5f): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0xb4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: In function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockStore2dOp>(mlir::xevm::BlockStore2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0x5f): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0xb4): more undefined references to `mlir::getConstantIntValue(mlir::OpFoldResult)' follow
collect2: error: ld returned 1 exit status
[6861/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/real.test.dir/real.cpp.o
[6862/7914] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[6863/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[6864/7914] Building InstCombineTables.inc...
[6865/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6866/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6867/7914] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6868/7914] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6869/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6870/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6871/7914] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6872/7914] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 50, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 41, in main
    run_command(["ninja"])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 63, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 4, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/15577

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6753/7914] Building CXX object tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/XCOFFDumper.cpp.o
[6754/7914] Building CXX object tools/llvm-sim/CMakeFiles/llvm-sim.dir/llvm-sim.cpp.o
[6755/7914] Creating library symlink lib/libLLVMExegesis.so
[6756/7914] Building CXX object tools/llvm-special-case-list-fuzzer/CMakeFiles/llvm-special-case-list-fuzzer.dir/special-case-list-fuzzer.cpp.o
[6757/7914] Building CXX object tools/llvm-stress/CMakeFiles/llvm-stress.dir/llvm-stress.cpp.o
[6758/7914] Building Opts.inc...
[6759/7914] Building Opts.inc...
[6760/7914] Building Opts.inc...
[6761/7914] Linking CXX executable bin/clang-import-test
[6762/7914] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockLoad2dOp>(mlir::xevm::BlockLoad2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0x68): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0xb7): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockPrefetch2dOp>(mlir::xevm::BlockPrefetch2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0x68): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0xb7): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockStore2dOp>(mlir::xevm::BlockStore2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0x68): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0xb7): more undefined references to `mlir::getConstantIntValue(mlir::OpFoldResult)' follow
collect2: error: ld returned 1 exit status
[6763/7914] Building CXX object tools/llvm-size/CMakeFiles/llvm-size.dir/llvm-size-driver.cpp.o
[6764/7914] Building CXX object tools/llvm-strings/CMakeFiles/llvm-strings.dir/llvm-strings.cpp.o
[6765/7914] Building CXX object tools/llvm-size/CMakeFiles/llvm-size.dir/llvm-size.cpp.o
[6766/7914] Linking CXX executable bin/llvm-objcopy
[6767/7914] Building CXX object tools/llvm-symbolizer/CMakeFiles/llvm-symbolizer.dir/llvm-symbolizer-driver.cpp.o
[6768/7914] Linking CXX static library lib/libLLVMExegesisX86_static.a
[6769/7914] Building CXX object tools/llvm-symbolizer/CMakeFiles/llvm-symbolizer.dir/llvm-symbolizer.cpp.o
[6770/7914] Linking CXX executable bin/clang-installapi
[6771/7914] Linking CXX executable bin/llvm-rust-demangle-fuzzer
[6772/7914] Linking CXX executable bin/llvm-remarkutil
[6773/7914] Linking CXX executable bin/llvm-readtapi
[6774/7914] Linking CXX executable bin/llvm-rc
[6775/7914] Linking CXX executable bin/llvm-special-case-list-fuzzer
[6776/7914] Linking CXX executable bin/llvm-pdbutil
[6777/7914] Linking CXX executable bin/llvm-stress
[6778/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/Fortran-features.cpp.o
[6779/7914] Linking CXX executable bin/llvm-sim
[6780/7914] Linking CXX shared library lib/libLLVMExegesisX86.so.21.0git
[6781/7914] Linking CXX executable bin/llvm-readobj
[6782/7914] Linking CXX shared library lib/libclangStaticAnalyzerCheckers.so.21.0git
[6783/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/logical.test.dir/logical.cpp.o
[6784/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/real.test.dir/real.cpp.o
[6785/7914] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[6786/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[6787/7914] Building InstCombineTables.inc...
[6788/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6789/7914] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6753/7914] Building CXX object tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/XCOFFDumper.cpp.o
[6754/7914] Building CXX object tools/llvm-sim/CMakeFiles/llvm-sim.dir/llvm-sim.cpp.o
[6755/7914] Creating library symlink lib/libLLVMExegesis.so
[6756/7914] Building CXX object tools/llvm-special-case-list-fuzzer/CMakeFiles/llvm-special-case-list-fuzzer.dir/special-case-list-fuzzer.cpp.o
[6757/7914] Building CXX object tools/llvm-stress/CMakeFiles/llvm-stress.dir/llvm-stress.cpp.o
[6758/7914] Building Opts.inc...
[6759/7914] Building Opts.inc...
[6760/7914] Building Opts.inc...
[6761/7914] Linking CXX executable bin/clang-import-test
[6762/7914] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockLoad2dOp>(mlir::xevm::BlockLoad2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0x68): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0xb7): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockPrefetch2dOp>(mlir::xevm::BlockPrefetch2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0x68): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0xb7): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockStore2dOp>(mlir::xevm::BlockStore2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0x68): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0xb7): more undefined references to `mlir::getConstantIntValue(mlir::OpFoldResult)' follow
collect2: error: ld returned 1 exit status
[6763/7914] Building CXX object tools/llvm-size/CMakeFiles/llvm-size.dir/llvm-size-driver.cpp.o
[6764/7914] Building CXX object tools/llvm-strings/CMakeFiles/llvm-strings.dir/llvm-strings.cpp.o
[6765/7914] Building CXX object tools/llvm-size/CMakeFiles/llvm-size.dir/llvm-size.cpp.o
[6766/7914] Linking CXX executable bin/llvm-objcopy
[6767/7914] Building CXX object tools/llvm-symbolizer/CMakeFiles/llvm-symbolizer.dir/llvm-symbolizer-driver.cpp.o
[6768/7914] Linking CXX static library lib/libLLVMExegesisX86_static.a
[6769/7914] Building CXX object tools/llvm-symbolizer/CMakeFiles/llvm-symbolizer.dir/llvm-symbolizer.cpp.o
[6770/7914] Linking CXX executable bin/clang-installapi
[6771/7914] Linking CXX executable bin/llvm-rust-demangle-fuzzer
[6772/7914] Linking CXX executable bin/llvm-remarkutil
[6773/7914] Linking CXX executable bin/llvm-readtapi
[6774/7914] Linking CXX executable bin/llvm-rc
[6775/7914] Linking CXX executable bin/llvm-special-case-list-fuzzer
[6776/7914] Linking CXX executable bin/llvm-pdbutil
[6777/7914] Linking CXX executable bin/llvm-stress
[6778/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/Fortran-features.cpp.o
[6779/7914] Linking CXX executable bin/llvm-sim
[6780/7914] Linking CXX shared library lib/libLLVMExegesisX86.so.21.0git
[6781/7914] Linking CXX executable bin/llvm-readobj
[6782/7914] Linking CXX shared library lib/libclangStaticAnalyzerCheckers.so.21.0git
[6783/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/logical.test.dir/logical.cpp.o
[6784/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/real.test.dir/real.cpp.o
[6785/7914] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[6786/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[6787/7914] Building InstCombineTables.inc...
[6788/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6789/7914] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 4, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/14367

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6850/7914] Creating library symlink lib/libclangStaticAnalyzerFrontend.so
[6851/7914] Linking CXX shared library lib/libclangFrontendTool.so.21.0git
[6852/7914] Creating library symlink lib/libclangFrontendTool.so
[6853/7914] Linking CXX shared module lib/SampleAnalyzerPlugin.so
[6854/7914] Linking CXX shared module lib/CheckerOptionHandlingAnalyzerPlugin.so
[6855/7914] Linking CXX shared module lib/CheckerDependencyHandlingAnalyzerPlugin.so
[6856/7914] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o
[6857/7914] Linking CXX shared library lib/libclangInterpreter.so.21.0git
[6858/7914] Creating library symlink lib/libclangInterpreter.so
[6859/7914] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockLoad2dOp>(mlir::xevm::BlockLoad2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0x55): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0xa4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockPrefetch2dOp>(mlir::xevm::BlockPrefetch2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0x55): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0xa4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockStore2dOp>(mlir::xevm::BlockStore2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0x55): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0xa4): more undefined references to `mlir::getConstantIntValue(mlir::OpFoldResult)' follow
collect2: error: ld returned 1 exit status
[6860/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/logical.test.dir/logical.cpp.o
[6861/7914] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[6862/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/real.test.dir/real.cpp.o
[6863/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[6864/7914] Building InstCombineTables.inc...
[6865/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6866/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6867/7914] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6868/7914] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6869/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6870/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6871/7914] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6872/7914] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 50, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 41, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 63, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6850/7914] Creating library symlink lib/libclangStaticAnalyzerFrontend.so
[6851/7914] Linking CXX shared library lib/libclangFrontendTool.so.21.0git
[6852/7914] Creating library symlink lib/libclangFrontendTool.so
[6853/7914] Linking CXX shared module lib/SampleAnalyzerPlugin.so
[6854/7914] Linking CXX shared module lib/CheckerOptionHandlingAnalyzerPlugin.so
[6855/7914] Linking CXX shared module lib/CheckerDependencyHandlingAnalyzerPlugin.so
[6856/7914] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o
[6857/7914] Linking CXX shared library lib/libclangInterpreter.so.21.0git
[6858/7914] Creating library symlink lib/libclangInterpreter.so
[6859/7914] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockLoad2dOp>(mlir::xevm::BlockLoad2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0x55): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm13BlockLoad2dOpEEEN4llvm13LogicalResultET_+0xa4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockPrefetch2dOp>(mlir::xevm::BlockPrefetch2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0x55): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm17BlockPrefetch2dOpEEEN4llvm13LogicalResultET_+0xa4): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o: in function `llvm::LogicalResult (anonymous namespace)::verifyMatrixInput<mlir::xevm::BlockStore2dOp>(mlir::xevm::BlockStore2dOp)':
XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0x55): undefined reference to `mlir::getConstantIntValue(mlir::OpFoldResult)'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:XeVMDialect.cpp:(.text._ZN12_GLOBAL__N_117verifyMatrixInputIN4mlir4xevm14BlockStore2dOpEEEN4llvm13LogicalResultET_+0xa4): more undefined references to `mlir::getConstantIntValue(mlir::OpFoldResult)' follow
collect2: error: ld returned 1 exit status
[6860/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/logical.test.dir/logical.cpp.o
[6861/7914] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[6862/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/real.test.dir/real.cpp.o
[6863/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[6864/7914] Building InstCombineTables.inc...
[6865/7914] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6866/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6867/7914] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6868/7914] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6869/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6870/7914] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6871/7914] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6872/7914] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 50, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 41, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 63, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 4, 2025

LLVM Buildbot has detected a new failure on builder mlir-nvidia running on mlir-nvidia while building mlir at step 6 "build-check-mlir-build-only".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/15567

Here is the relevant piece of the build log for the reference
Step 6 (build-check-mlir-build-only) failure: build (failure)
...
36.990 [80/16/5220] Linking CXX shared library lib/libMLIRLinalgTestPasses.so.21.0git
36.998 [79/16/5221] Creating library symlink lib/libMLIRLinalgTestPasses.so
37.185 [78/16/5222] Linking CXX shared library lib/libMLIRGPUTestPasses.so.21.0git
37.193 [77/16/5223] Creating library symlink lib/libMLIRGPUTestPasses.so
37.394 [76/16/5224] Linking CXX shared library lib/libMLIRTestPass.so.21.0git
37.401 [75/16/5225] Creating library symlink lib/libMLIRTestPass.so
37.518 [74/16/5226] Linking CXX shared library lib/libMyExtensionCh2.so.21.0git
37.526 [73/16/5227] Creating library symlink lib/libMyExtensionCh2.so
46.577 [72/16/5228] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o
46.694 [71/16/5229] Linking CXX shared library lib/libMLIRXeVMDialect.so.21.0git
FAILED: lib/libMLIRXeVMDialect.so.21.0git 
: && /usr/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Werror=mismatched-tags -Werror=global-constructors -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics   -Wl,--gc-sections -shared -Wl,-soname,libMLIRXeVMDialect.so.21.0git -o lib/libMLIRXeVMDialect.so.21.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib:"  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib && :
ld.lld: error: undefined symbol: mlir::getConstantIntValue(mlir::OpFoldResult)
>>> referenced by XeVMDialect.cpp
>>>               tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:(mlir::xevm::BlockLoad2dOp::verify())
>>> referenced by XeVMDialect.cpp
>>>               tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:(mlir::xevm::BlockLoad2dOp::verify())
>>> referenced by XeVMDialect.cpp
>>>               tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRXeVMDialect.dir/IR/XeVMDialect.cpp.o:(mlir::xevm::BlockStore2dOp::verify())
>>> referenced 3 more times
clang: error: linker command failed with exit code 1 (use -v to see invocation)
77.946 [71/15/5230] Building CXX object tools/mlir/tools/mlir-query/CMakeFiles/mlir-query.dir/mlir-query.cpp.o
78.317 [71/14/5231] Building CXX object tools/mlir/tools/mlir-rewrite/CMakeFiles/mlir-rewrite.dir/mlir-rewrite.cpp.o
78.831 [71/13/5232] Building CXX object tools/mlir/tools/mlir-lsp-server/CMakeFiles/mlir-lsp-server.dir/mlir-lsp-server.cpp.o
78.844 [71/12/5233] Building CXX object tools/mlir/unittests/Target/LLVM/CMakeFiles/MLIRTargetLLVMTests.dir/SerializeROCDLTarget.cpp.o
80.095 [71/11/5234] Building CXX object tools/mlir/unittests/Target/LLVM/CMakeFiles/MLIRTargetLLVMTests.dir/SerializeNVVMTarget.cpp.o
82.247 [71/10/5235] Building CXX object tools/mlir/examples/toy/Ch7/CMakeFiles/toyc-ch7.dir/toyc.cpp.o
83.722 [71/9/5236] Building CXX object tools/mlir/unittests/ExecutionEngine/CMakeFiles/MLIRExecutionEngineTests.dir/Invoke.cpp.o
84.085 [71/8/5237] Building CXX object tools/mlir/examples/transform/Ch2/CMakeFiles/transform-opt-ch2.dir/transform-opt/transform-opt.cpp.o
84.561 [71/7/5238] Building CXX object tools/mlir/tools/mlir-reduce/CMakeFiles/mlir-reduce.dir/mlir-reduce.cpp.o
85.480 [71/6/5239] Building CXX object tools/mlir/tools/mlir-opt/CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o
85.774 [71/5/5240] Building CXX object tools/mlir/tools/mlir-opt/CMakeFiles/MLIRMlirOptMain.dir/mlir-opt.cpp.o
85.875 [71/4/5241] Building CXX object tools/mlir/lib/CAPI/RegisterEverything/CMakeFiles/obj.MLIRCAPIRegisterEverything.dir/RegisterEverything.cpp.o
86.005 [71/3/5242] Building CXX object tools/mlir/examples/toy/Ch5/CMakeFiles/toyc-ch5.dir/toyc.cpp.o
88.599 [71/2/5243] Building CXX object tools/mlir/examples/transform/Ch3/CMakeFiles/transform-opt-ch3.dir/transform-opt/transform-opt.cpp.o
89.960 [71/1/5244] Building CXX object tools/mlir/examples/toy/Ch6/CMakeFiles/toyc-ch6.dir/toyc.cpp.o
ninja: build stopped: subcommand failed.

adam-smnk added a commit to adam-smnk/llvm-project that referenced this pull request Jul 4, 2025
adam-smnk added a commit that referenced this pull request Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants